package com.just.bz_back.controller.user;

import com.just.bz_back.config.CheckRole;
import com.just.bz_back.model.TypeLocationRelation;
import com.just.bz_back.model.dto.JsonData;
import com.just.bz_back.service.LocationService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author : baibaiwucahng
 * @date : 2019/8/31  15:25
 */
@RestController
@RequestMapping("/api/v1/user/location")
public class LocationController {

    @Resource
    private LocationService locationService;

    @CheckRole(role = "user",roleId = 1)
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    public JsonData getListById(@RequestBody TypeLocationRelation typeLocationRelation)
    {
            return JsonData.buildSuccess(locationService.getListByTypeId(typeLocationRelation.getTypeId()),0);
    }
}
